import Vue from "vue";
import Router from "vue-router";
Vue.use(Router);

const router = new Router({
  mode: 'history',
  base: 'personalPayReport',
  routes: [
    {
      path: "/pc",
      name: "pchome",
      meta: {
        title: '知 付'
      },
      component: () => import("@/views/pcHome"),
      children: []
    },
    {
      path: "/",
      name: "home",
      mode: 'history',
      component: () => import("@/views/Home"),
      children: [],
      meta: {
        title: '知 付'
      }
    },
    {
      path: "/MobileTab",
      name: "mobileTab",
      component: () => import("@/views/detailPages/index"),
    },
    {
      path: "/DailyReport",
      name: "dailyReport",
      meta: {
        title: '日清日结'
      },
      component: () => import("@/views/dailyReport/index")
    },
    {
      path: "/payReport",
      name: "payReport",
      meta: {
        title: '付薪报告'
      },
      component: () => import("@/views/payReport/index")
    },
    {
      path: "/PostpayReport",
      name: "PostpayReport",
      meta: {
        title: '付薪报告'
      },
      component: () => import("@/views/payReport/index")
    },
    {
      path: "*",
      name: "error",
      component: () => import("@/views/Error"),
      alias: "/404"
    }
  ]
});

router.beforeEach((to, from, next) => {
  if (to.meta.title) {
    document.title = to.meta.title;
  }
  next();
});

export default router